package apiday01;

public class equals和全等区别 {
    public static void main(String[] args) {
        String s = new String("hello");//创建2个对象
        String s1 = "hello";//复用常量池中的字面量对象
        System.out.println(s);
        System.out.println(s1);
        System.out.println(s == s1);//false,地址不同
        System.out.println(s.equals(s1));//true,比较值是否相等
    }
}
